package com.ihr360.job.core.item.support;

import com.ihr360.job.core.item.ItemReader;

/**
 * An {@link ItemReader} that pulls data from one shot. Useful for one item reader.
 *
 * @author Dave Syer
 *
 */
public class OneShotItemReader<T> implements ItemReader<T> {

    private T item;
    private  boolean hasRead = false;
    public OneShotItemReader(T item) {
        this.item = item;
    }

    @Override
    public T read() {
        if (hasRead){
            return null;
        }
        return item;
    }

}
